function http({
  url,
  method = "get",
  data
}) {
  let baseURL = "/api"
  return new Promise((resolve, reject) => {
    uni.request({
      url: baseURL + url,
      method: method,
      data: data,
      header: {
        // 修改请求内容类型
        // "content-type": "application/x-www-form-urlencoded"
      },
      success: (res) => {
        resolve(res.data)
      },
      fail: (err) => {
        reject(err)
      }
    })
  })
}
export default http;